<?php
require_once ("../db/connectdatabase.php");

function insertQuestion($question, $answer) {
	$con = new ConnectDB();
	$tbl = "loan_question_cs_hoa_hong";
	$fn = array('idques' => time(), 'question' => $question, 'answerq' => $answer, 'dateupdate' => time());
	return $con -> insert($tbl, $fn);
}

function updateQuestion($id, $question, $answer) {
	$con = new ConnectDB();
	$tbl = "loan_question_cs_hoa_hong";
	$fn = array('question' => $question, 'answerq' => $answer, 'dateupdate' => time());
	$condition = array('idques' => $id);
	return $con -> update($tbl, $fn, $condition);
}

function updateDisplayQuestion($id, $use) {
	$con = new ConnectDB();
	$tbl = "loan_question_cs_hoa_hong";
	$fn = array('isuser' => $use, 'dateupdate' => time());
	$condition = array('idques' => $id);
	return $con -> update($tbl, $fn, $condition);
}

function deleteQuestion($idquestion) {
	$con = new ConnectDB();
	$tbl = "loan_question_cs_hoa_hong";
	$condition = array('idques' => $idquestion);
	return $con -> delete($tbl, $condition);
}

?>